/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-05-20
 * Time: 10:35
 */
//奇偶分类
public class code2 {
    public static void swap(int[] array,int i,int j){
        int tmp=array[j];
        array[j]=array[i];
        array[i]=tmp;
    }

    public static void transform(int[] array){
        int n=array.length;
        int l=0,r=n-1;
        while(l<r){
            if(array[l]%2==0){
                swap(array,l,r);
                r--;
            }
            else
                l++;
        }
    }
    public static void main(String[] args) {
        int[] array={1,3,5,7,9};
        transform(array);
        for(int x:array){
            System.out.print(x+" ");
        }
    }
}
